package com.hpq.common.utils;

import com.hpq.common.domain.dto.RequestInfo;
/**
 * 请求上下文持有者
 */
public class RequestHolder {
    private static final ThreadLocal<RequestInfo> threadLocal = new ThreadLocal<>();
    /**
     * 保存请求信息
     * @param requestInfo
     */
    public static void set(RequestInfo requestInfo){
        threadLocal.set(requestInfo);
    }
    /**
     * 获取请求信息
     * @return
     */
    public static RequestInfo get(){
        return threadLocal.get();
    }
    /**
     * 销毁请求信息
     */
    public static void remove(){
        threadLocal.remove();
    }
}
